
 <!-- 产品列表 -->
<script lang="ts">
export default {
  name: "zwzzproductList",
};
</script>
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">
      产品列表
    </p>
    <div>
      <dxtable :headBtn="headBtn" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" ref="databale"
        sonRouter="zwzzxbproduct"></dxtable>
    </div>
  </div>
  <n-modal v-model:show="showModal" preset="card" class="dsfsdrewrewe">
    <template #header>
      <div>浏览二维码</div>
    </template>
    <div>
      <img :src="qcosertt" class="fsdfereertr">
    </div>
    <template #action>
      <div class="tr">
        <n-button @click="showModal = false"> 关闭 </n-button>
      </div>
    </template>
  </n-modal>
</template>
<script lang='ts' setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf } from "../../util/index";
import { h, ref, reactive, onBeforeUpdate } from "vue";
const props = defineProps({
  pup: { type: String },
});
const roleId = localStorage.id
const showModal = ref(false)
const qcosertt = ref()
let portUrl = "jwzz/product";
let headBtn = [];
const zdList = ref()
const databale = ref();
const videourl = ref()
const typeli = ref([])
const nksdlist = ref([])
const initeer = () => {
  databale.value.initDataExpose();
};
const emit = defineEmits(["callBack"]);
// 弹窗公用该列表
let dataJson = reactive([
  {
    title: "id",
    key: "id",
    width: 50,
  },

  {
    title: "产品标题",
    search: true, // 是否在搜索栏展示
    key: "title",
    width: 400,
  },
  {
    title: "封面",
    key: "doctor",
    render(row) {
      // dxpost(portUrl,{id:row.id,qcCode:})
      return h('span', {
        class: "ls sz", onClick: async () => {
          qcosertt.value = row.cover
          showModal.value = true
        }
      }, "浏览封面")
    }
  },
  {
    title: "分类",
    search: true, // 是否在搜索栏展示
    type: "select",
    options: [],
    key: "fenlei",
    render(row) {
      try {
        return nksdlist.value.filter(a => a.value == row.fenlei)[0].label
      } catch (e) {

      }
    }
  },

  {
    title: "所属行业",
    search: true, // 是否在搜索栏展示
    type: "select",
    options: [],
    key: "profession",
    render(row) {
      try {
        return typeli.value.filter(a => a.value == row.profession)[0].label
      } catch (e) {

      }
    }
  },
  {
    title: "排序",
    width: 100,
    render(row) {
      row.databaseName = "zwzzproductList";
      return h(sort, {
        row,
        onCallBack: () => {
          initeer();
        },
      });
    },
  },
  {
    title: "添加时间",
    key: "addTime",
    width: "140",
    type: "daterange",
  },
]);

const qx = {
  DeletePermissionID: "zwzzproductListdel", //删除
  EditPermissionIdentifier: "zwzzproductListbj", // 编辑
  NewPermissionIdentifier: "zwzzproductListxz", // 新建
  ViewPermissionID: "zwzzproductListck", // 查看
};

const getfls = async () => {
  const { data }: any = await dxget("dxgjAdmin/getfls", { roleId })
  let kjknsdrf = []
  data.map(a => {
    kjknsdrf.push({
      label: a.cate_name,
      value: '' + a.id
    })
  })
  dataJson[3].options = [
    {
      label: "全部",
      value: ""
    },
    ...kjknsdrf
  ]
  console.log(dataJson[3].options);
  nksdlist.value = kjknsdrf
}

getfls()

const getcasetype = async () => {
  const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'applicationIndustry' })

  dataJson[4].options = [
    {
      label: "全部",
      value: ""
    },
    ...data
  ]
  console.log(dataJson[4].options);
  console.log('66666');
  typeli.value = data
}
getcasetype()

</script>
<style scoped>
.fsdfereertr {
  width: 100%;
  height: 360px;
}
</style>
   
   
   